import http from '../../AxiosInstance'
//http/module/sendQuestionApi
export const sendQuestionApi = (data) => {
    return http({
        url: '/questions/',
        method: 'post',
        data
    })
}

// http/module/getQuestionApi
export const getQuestionApi = (params = {}) => {
  return http("/questions/list", {
    method: "get",
    params: {
      page: params ,
      size: 10
    }
  });
};
// http/module/getQuestionDetailApi
export const getQuestionDetailApi = (id) => {
  return http(`/questions/get/${id}`, {
    method: "get",
  });
}
// http/module/getTop5Api
export const getTop5Api = () => {
  return http("/questions/top5", {
    method: "get",
  });
}
// http/module/deleteQuestionApi
export const deleteQuestionApi = (id) => {
  return http(`/questions/${id}`, {
    method: "delete",
  });
}
// http/module/ReplyAnswerQuestionApi
export const ReplyQuestionAnswerApi = (data) => {
  return http({
    url: `/answers/${data.id}`,
    method: 'post',
    data:{
      content: data.content
    }
  })
}
// http/module/getReplyAnswerQuestionApi
export const getReplyAnswerQuestionApi = (questionId) => {
  return http(`/answers/`, {
    method: "get",
    params:{
      questionId
    }
  });
}
// http/module/getMyFollowedUserQuestionApi
export const getMyFollowedUserQuestionApi = () => {
  return http("/questions/follow", {
    method: "get",
  });
};
// http/module/getMyFollowedUserAnswerApi
export const getMyFollowedUserAnswerApi = () => {
  return http("/answers/followed", {
    method: "get",
  });
};
//http/module/userPostQuestionAnswerApi
export const userPostQuestionAnswerApi = (data) => {
  return http(`/answers/${data.questionId}`, {
    method: "post",
    data:{
      content: data.content
    }
  });
};
//http/module/userDeleteQuestionAnswerApi
export const userDeleteQuestionAnswerApi = (id) => {
  return http(`/answers/${id}`, {
    method: "delete",
  });
};  
//http/module/userCommentListApi
export const getQuestionUserCommentListApi = (id) => {
  return http(`/comments/${id}`, {
    method: "get",
  });
};
